<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Amaze UI Admin index Examples</title>
<include file="Public:top"/>
</head>
<body>
<!--[if lte IE 9]><p class="browsehappy">升级你的浏览器吧！ <a href="http://se.360.cn/" target="_blank">升级浏览器</a>以获得更好的体验！</p><![endif]-->
</head>

<body>
<header class="am-topbar admin-header">
<include file='Public:header'/>
 </header>

<div class="am-cf admin-main"> 

<include file='Public:left'/>
		<include file='Public:intro'/>
<div class="admin"> 
    <div class="admin-biaoge">   
    <div class="shuju">
      <script type="text/javascript">jQuery(".slideTxtBox").slide();</script> 
</div>
    <div class="foods">
    <include file='Public:footer'/>
    </div>
</div>
</div>
</div>
</div>
</div>
   <div style="display:none" id="upd_1">
           <table cellpadding="0" cellspacing="0" class="layui-table" style="width:400px" lay-skin="row">
            <tr>
                <td>请输入旧密码:</td>
                <td><input type="password" id="oldpassword" name="oldpassword" class="layui-input" placeholder="请输入旧密码"></td>
            </tr>
           </table>
     </div>

 <div>
		 	<div style="display:none" id="upd">
      		 <table cellpadding="0" cellspacing="0" class="layui-table" style="width:400px" lay-skin="row">
            <tr>
                <td>请输入新密码:</td>
                <td><input type="password" id="admin_password" name="admin_password" class="layui-input" placeholder="请输入新密码"></td>
             </tr>
             <tr>
                 <td>重新输入新密码:</td>
                <td><input type="password" id="repassword" name="repassword" class="layui-input" placeholder="重新输入新密码"></td>
            </tr>
           </table>
		 </div>	
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/polyfill/rem.min.js"></script>
<script src="assets/js/polyfill/respond.min.js"></script>
<script src="assets/js/amazeui.legacy.js"></script>
<![endif]--> 

<!--[if (gte IE 9)|!(IE)]><!--> 
<script src="__PUBLIC__/Admin/js/amazeui.min.js"></script>
<!--<![endif]-->

    <script>
  function upd_1(){
      layui.use('layer', function () {
            layer.open({          // 普通信息弹窗
                    type:1,
                    title:'你的旧密码',
                    content:$("#upd_1"),
                    shadeClose:true,
                    area:['400px','200px'],
                    btn:['确定','取消'],
                    btn1: function (index) {
                        $.ajax({
                           type:'POST',
                           url:'index_add',
                           data:'oldpassword='+$('#oldpassword').val(),
                           dataType:'json',
                           success:function(data){
                               if(data == 1){
                                 layer.msg('原密码正确',{icon:6,time:500},function upd(){
                                     layui.use('layer',function(){
                                      layer.open({
                                        type:1,
                                        title:'修改密码',
                                        content:$('#upd'),
                                        shadeClose:true,
                                        area:['400px','300px'],
                                        btn:['确定','取消'],
                                        btn1:function(index){
                                          $.ajax({
                                            type:'POST',
                                            url:'index_upd',
                                            data:'admin_password='+$('#admin_password').val()+'&repassword='+$('#repassword').val(),
                                            dataType:'json',
                                            success:function(data){
                                              if(data==1){
                                                layer.msg('修改成功',{icon:6,time:500},function(){
                                                  location.href=location.href;
                                                })
                                                layer.close(index);
                                              }else{
                                                layer.msg('两次密码不一致',{icon:7,time:1000});
                                              }
                                            },
                                            error:function(data){
                                              console.log(data);
                                            }
                                          })
                                        },
                                        btn2:function(){
                                          layer.msg('取消修改',{icon:7,time:2000})
                                        }
                                      })
                                     })
                                 })
                                 layer.close(index);
                               }else{
                                  layer.msg('原密码错误',{icon:7,time:1000});  
                               }
                           },
                           error:function(data){
                              console.log(data);
                           }
                        })
                    },
                    btn2: function () {
                        layer.msg('取消修改',{icon:7,time:2000})
                    }

            });
        })
      
    }
  </script>

</body>
</html>